package DataStorageClasses;

import java.sql.Date;

import org.json.JSONException;
import org.json.JSONObject;

public class FinanceSheet 
{
	private double gross;
	private double wages;
	private double amtOwed;
	private double taxRate;
	private Date start;
	private Date end;
	
	public FinanceSheet(double gross, double wages, double amtOwed, double taxRate, Date start, Date end)
	{
		this.gross = gross;
		this.wages = wages;
		this.amtOwed = amtOwed;
		this.taxRate = taxRate;
		this.start = start;
		this.end = end;
	}
	
	public double getGrossIncome()
	{
		return gross;
	}
	public double getWagesPaid()
	{
		return wages;
	}
	
	public double getAmountClientsOwe()
	{
		return amtOwed;
	}
	
	public double getTaxRate()
	{
		return taxRate;
	}
	
	public double getTaxDeduction()
	{
		return taxRate*gross;
	}
	
	public double getNetPreTax()
	{
		return gross-wages;
	}
	
	public double getNetPostTax()
	{
		return gross-wages-getTaxDeduction();
	}
	
	public Date getStartDate()
	{
		return start;
	}
	
	public Date getEndDate()
	{
		return end;
	}
	
	public JSONObject getJSONObject() throws JSONException
	{
		JSONObject json = new JSONObject();
		json.put("gross", gross);
		json.put("wages", wages);
		json.put("amtOwed", amtOwed);
		json.put("taxRate", taxRate);
		json.put("taxDeduction", getTaxDeduction());
		json.put("netPreTax", getNetPreTax());
		json.put("netPostTax", getNetPostTax());
		json.put("start", start.toString());
		json.put("end", end.toString());
		
		return json;
	}
}
